<?php


/**
 * 模块示例模块定义
 *
 * @author xluwei
 * @url
 */


defined('IN_IA') or exit('Access Denied');

class Cjtc_mzsModule extends WeModule
{

    private $wxapp;
    public function __construct()
    {
        global  $_W;
		
        $tt = json_encode($_W['account']);
	
        $this->wxapp = json_decode($tt,true);

		//var_dump($this->wxapp);die;
       
    }


    public function run()
    {
        //校验后台入口文件
       // $this->checkModuleFile();




        //设置登录状态
        $this->setLoginStatus();

        //跳转后台

        $this->passport();
    }


    private function checkModuleFile()
    {
        if(!file_exists(__DIR__.'/index.php')){
            die('缺少入口文件');
        }

        return true;
    }


    private function setLoginStatus()
    {
        if (session_status() != PHP_SESSION_ACTIVE) {
            session_start();
        }


        $_SESSION['we8'] = $this->wxapp;
        $_SESSION['ims_version'] = IMS_VERSION;

    }


    private function passport()
    {


        global  $_W;
        $url = $_W['siteroot'] . 'addons/' . $_W['current_module']['name'] . '/admin.php?s=WeLogin/index';
		
        header('Location:'.$url);
        exit();
    }
}


(new Cjtc_mzsModule())->run();
